<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	  <title>{$username}_个人主页{get_seo_suffix()}</title>
	  <meta name="author" content="YzmCMS内容管理系统/QQ:214243830">
	  <meta name="keywords" content="{$username},{$username}个人主页,YzmCMS会员个人主页" />
	  <meta name="description" content="{get_config('site_description')}" />
	  <link href="{STATIC_URL}css/yzm-member-myhome.css" rel="stylesheet" type="text/css" />
	  <script type="text/javascript" src="{STATIC_URL}js/jquery-1.8.2.min.js"></script>
	  <script type="text/javascript" src="{STATIC_URL}plugin/layer/layer.js"></script>
  </head>
  <body>
    <div id="container">	
		<div id="toppic">{$username}_个人主页</div>
		<div id="top">
			<div class="feeb">
				<img src="{if $userpic}{$userpic}{else}{STATIC_URL}images/default.gif{/if}" alt="{$username}" title="{$username}"/>
			</div>
			<div class="userinfo">
				<div class="username">{$username}<span class="grade">[{$groupinfo['name']}] {if $groupinfo['icon']}<img src="{STATIC_URL}images/icon/{$groupinfo['icon']}">{/if} {if $vip}<img src="{STATIC_URL}images/vip.png" class="vip" title="vip用户">{/if}</span></div>
				<div class="userinfo_userdata">
					<span class="qianming"><b>个性签名：</b> {if $motto}{$motto}{else}暂无{/if}</span>
					<span class="fangkeshu"><b>空间访问量：</b> {$guest}</span>
				</div>
			</div>
			<div class="userinfo_shortcut">
				<a href="{U('index/index/init')}">返回首页</a> |
				<a href="{U('member/index/init')}">会员中心</a>
			</div>		
		</div>
		<div class="clearfix"></div>
		<div id="main">
		  <div id="main_left">
		     <h1>内容列表</h1>
			 <ul class="list">
			 {loop $data $val}
			 <li><span>{date('Y-m-d H:i:s',$val['inputtime'])}</span><a href="{$val[url]}" target="_blank" title="{$val[title]}">{$val[title]}</a></li>
			 {/loop}
			 </ul>
			 <div id="page">{$pages}</div>			 
		  </div>
		  <div id="main_right">
		    <div class="jianjie">
			 <h2 class="right_title">个人简介</h2>
			 <p>{if $introduce}{$introduce}{else}<span style="color:#aaa">这家伙很懒，什么都没写呢~</span>{/if}</p>
			</div>			
		    <div class="jianjie">
			 <h2 class="right_title">其他操作</h2>
			 <p><a href="{U('member/messages/new_messages', array('username'=>$username))}">发信息</a> | <a href="javascript:;" id="follow" onclick="follow('{$userid}');">加关注</a></p>
			</div>	
		    <div class="laifang">
			 <h2 class="right_title">最近访客</h2>
			 <ul>
			 {loop $guest_data $val}
			 <li>
			 	<a href="{U('myhome/init', array('userid'=>$val['guest_id']))}">
			 		<img src="{get_memberavatar($val['guest_id'])}" alt="{$val[guest_name]}" title="{$val[guest_name]}"/>
			 	</a>
			 	<p>{date('m月d日',$val['inputtime'])}</p>
			 </li>
			 {/loop}			 
			 </ul>
			</div>			
		  </div>		  
		</div>
    </div>	
  </body>
	<script type="text/javascript">
	check_follow();
	function follow(userid) {
		$.ajax({
			type: 'POST',
			url: "{U('member/index/public_follow')}", 
			data: 'userid='+userid,
			success: function (msg) {
				if(msg == 1){
					$("#follow").html('已关注');
					layer.msg("关注成功！\n以后对方发布新文章时，会在您的会员中心显示哦！", {icon:1});
				}else if(msg == 2){
					$("#follow").html('加关注');
					layer.msg("已取消关注", {icon:1});
				}else if(msg == 0){
					layer.msg('请先登录！', {icon:2});
				}else if(msg == -3){
					layer.msg('不能关注自己哦~', {icon:2});
				}else if(msg == -1){
					layer.msg('该用户不存在！', {icon:2});
				}else{
					layer.msg('非法操作！', {icon:2});
				}
			}
		});
	}

	function check_follow() {
		$.ajax({
			type: 'GET',
			url: "{U('api/index/check_follow', array('userid'=>$userid))}", 
			dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					$("#follow").html(msg.message);       
			    }
            }
		});
	}
	</script>
</html>